﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication4
{
    public partial class Cpu : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            
            for (int i = 0; i < GridView3.Rows.Count; i++)
            {

                GridViewRow rows = GridView3.Rows[i];
                bool isChecked = ((CheckBox)rows.FindControl("select1")).Checked;
                TextBox text = (TextBox)rows.FindControl("txtQuantity1");
                if (isChecked)
                {
                    string id = GridView3.Rows[i].Cells[0].Text;
                    string name = GridView3.Rows[i].Cells[1].Text;
                    string brand = GridView3.Rows[i].Cells[2].Text;
                    string category = GridView3.Rows[i].Cells[3].Text;
                    string price = GridView3.Rows[i].Cells[4].Text;



                    Session["id" + Default.j] = id;
                    Session["name" + Default.j] = name;
                    Session["brand" + Default.j] = brand;
                    Session["category" + Default.j] = category;
                    Session["price" + Default.j] = price;
                    Session["quantity" + Default.j] = text.Text;



                    Default.j++;
                    Label3.Text = "Your item(s) has been added to the cart";

                }
            }
        }
    }
}